<?php

if(!function_exists('trigger_stat'))
{
	function trigger_stat($ays_name, $curr_url = 'auto', $ref_url = 'auto', $cookie_arr = 'auto', $ip = 'auto', $add_param = '')
	{
		$http_obj = Bin::singtolen('HttpConnectionClass::trigger_stat', 'Source');
		$http_obj->setHeader(array('user-agent:trigger_stat'));
		$http_obj->setCookie(is_array($cookie_arr) ? $cookie_arr : $_COOKIE);
		$stat_url = "http://site-stat.".G_CURRENT_DOMAIN.'/'.$ays_name.'?ref='.($ref_url == 'auto' ? @strval($_SERVER['HTTP_REFERER']) : $ref_url).'&ip='.($ip == 'auto' || empty($ip) ? G_CLIENT_IP : $ip).(empty($add_param) ? '' : '&'.$add_param);
		return $http_obj->getData($stat_url, true, $curr_url == 'auto' || empty($curr_url) ? "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" : $curr_url, 2);
	}
}
